package com.qef.com.mmovie.presenter;

import com.qef.com.mmovie.api.DowLoadServer;
import com.qef.com.mmovie.mvp.interactor.DownloadInteractor;
import com.qef.com.mmovie.net.IGetDataDelegate;
import com.qef.com.mmovie.presenter.contract.DowloadContract;

import javax.inject.Inject;

import io.reactivex.disposables.Disposable;
import okhttp3.ResponseBody;

/**
 * Created by feq on 2017/7/21.
 */

public class DowloadPresenter extends RxPresenter<DowloadContract.View> implements DowloadContract.Presenter {
    @Inject
    DownloadInteractor downloadInteractor;

    @Inject
    public DowloadPresenter() {
    }

    @Override
    public void getUpdata(String url) {
        Disposable disposable = downloadInteractor.getUpdata("", new IGetDataDelegate<ResponseBody>() {
            @Override
            public void getDataSuccess(ResponseBody responseBody) {
                mView.showContent(responseBody);
            }

            @Override
            public void getDataError(Throwable throwable) {
                mView.error(throwable);
            }
        });
        addSubscrebe(disposable);
    }
}
